﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.VisualBasic;

namespace Framework.Extensions
{
    public static class StringExt
    {
        public static string Default(this string item, string value)
        {
            return (string.IsNullOrEmpty(item)) ? value : item;
        }

        public static string Safe(this string item)
        {
            return item.Default(string.Empty);
        }

        public static string[] Split(this string value, string a)
        {
            return Microsoft.VisualBasic.Strings.Split(value, a);
        }

        public static string[] Split(this string value, char a)
        {
            return value.Split(a.ToString());
        }

        public static StringBuilder FormatLine(this StringBuilder sb, string format, params object[] args)
        {
            return sb.AppendFormat(format, args).AppendLine();
        }
    }
}
